﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CDSB.Indicators.Model;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace CDSB.Indicators.Communication.Translator
{
    public static class TFSWorkItemToCDSBScenario
    {
        public static CDSBScenario TranlateToCDSBScenario(this WorkItem wItem)
        {
            CDSBScenario Scenario = new CDSBScenario();

            Scenario.ID = wItem.Id;
            Scenario.Project = wItem.Project.Name;
            Scenario.State = wItem.State;
            Scenario.Title = wItem.Title;
            Scenario.Area = wItem.AreaPath.Substring(wItem.AreaPath.IndexOf(@"\") + 1);
            if (Scenario.Area.LastIndexOf(@"\") > 0) Scenario.Area = Scenario.Area.Remove(Scenario.Area.LastIndexOf(@"\"));

            return Scenario;
        }
    }
}
